import type { RowType } from '#/views/system/sysOperateLog/sysOperateLog.data';

import { requestClient } from '#/api/request';

export namespace SysOperateLogTableApi {
  export type RowTypeFetchParams = RowType;
  export interface IdFetchParams {
    id: string;
  }
  export interface ListFetchParams {
    [key: string]: any;
  }
  export interface PageListFetchParams {
    [key: string]: any;
    pageNo: number;
    pageSize: number;
  }
}

/**
 * 分页列表查询
 */
export async function sysOperateLogQueryPageListApi(
  params: SysOperateLogTableApi.PageListFetchParams,
) {
  return requestClient.get('/system/sysOperateLog/queryPageList', { params });
}

/**
 * 列表查询
 */
export async function sysOperateLogQueryListApi(
  params: SysOperateLogTableApi.ListFetchParams,
) {
  return requestClient.get('/system/sysOperateLog/queryList', { params });
}

/**
 * 通过ID查询
 * @param params
 */
export async function sysOperateLogQueryByIdApi(
  params: SysOperateLogTableApi.IdFetchParams,
) {
  return requestClient.get('/system/sysOperateLog/queryById', { params });
}

/**
 * 新增
 */
export async function sysOperateLogAddApi(
  params: SysOperateLogTableApi.RowTypeFetchParams,
) {
  return requestClient.post('/system/sysOperateLog/add', params);
}

/**
 * 编辑
 */
export async function sysOperateLogEditApi(
  params: SysOperateLogTableApi.RowTypeFetchParams,
) {
  return requestClient.post('/system/sysOperateLog/edit', params);
}

/**
 * 删除
 * @param id 主键
 */
export async function sysOperateLogDelApi(id) {
  return requestClient.delete<boolean>(`/system/sysOperateLog/delete/${id}`);
}

/**
 * 批量删除删除
 * @param ids 主键
 */
export async function sysOperateLogDeleteBatchApi(ids) {
  return requestClient.delete<boolean>(
    `/system/sysOperateLog/deleteBatchByIds/${ids}`,
  );
}
